package org.caijin.springzookeeper.lock;

public abstract class AbstractLock implements Lock {
    @Override
    public void lock() {
        // 尝试获取锁
        if (tryLock()){
            System.out.println("....获取锁...");
        }else {
            //等待锁
            waitLock();
            //重试
            lock();
        }
    }

    //尝试获取锁
    public abstract boolean tryLock();
    //等待锁
    public abstract void waitLock() ;

}
